<template>
	<view>
		<view class="header">
			<i class="ri-function-fill" style="color:#7800BE;font-size:14px;"></i>
			<!-- <i-icon size="20upx" color="#7800BE" name="function-fill"></i-icon> -->
			控制台
			<i class="ri-arrow-right-s-line" style="color:#666;font-size:14px;"></i>
			<!-- <i-icon size="20upx" color="#666" name="arrow-right-s-line"></i-icon> -->
			个人电子账户
			<i class="ri-arrow-right-s-line" style="color:#666;font-size:14px;"></i>
			<!-- <i-icon size="20upx" color="#666" name="arrow-right-s-line"></i-icon> -->
			申请电子账户
		</view>
		<view class="bkk">
			<view class="bl b20">
				<view class="bc">
					<view class="bc" style="margin-bottom: 30px;">
						<i class="ri-user-3-fill" style="color:#7800BE;font-size:30px;"></i>
						<!-- <i-icon size="30px" color="#7800BE" name="user-3-fill"></i-icon> -->
						<text style="font-size: 28px;">填写个人信息</text>
					</view>
				</view>
			</view>
			<view class="bk b10 bc">
				<view class="r30" style="width: 150px;">真实姓名</view>
				<input type="text" v-model="bankAccName" placeholder="真实姓名" style="width:200px;" />
			</view>
			<view class="bk b10 bc">
				<view class="r30" style="width: 150px;">身份证号码</view>
				<input type="idcard" v-model="cerNo" maxlength="18" placeholder="身份证号码" style="width:400px;" />
			</view>
			<view class="bk b10 bc" style="margin-top: 10px;">
				<view class="r30" style="width: 150px;">身份证有效期</view>
				<view class="bc r10 sjk">
					<uni-datetime-picker type="date" placeholder="开始日期" border="false" @change="timestampChange"
						class="r10" />
					<uni-datetime-picker type="date" placeholder="结束日期" border="false" @change="timestampChange2" />
				</view>
				<view>
					<checkbox-group @change="checkboxChange2" style="display:inline;">
						<checkbox :checked="state2"></checkbox>
					</checkbox-group>长期
				</view>
			</view>

			<view class="bc" style="margin-top: 30px;">
				<view class="r30" style="width: 150px;">
					<view class="">
						身份证人像面
					</view>
					<view class="action">
						{{imgList.length}}/1
					</view>
				</view>
				<view class="cu-form-group">
					<view class="grid col-4 grid-square flex-sub">
						<view class="bg-img r30" v-for="(item,index) in imgList" :key="index" @tap="ViewImage"
							:data-url="imgList[index]">
							<image :src="imgList[index]" mode='widthFix'></image>
							<view class="cu-tag bg-red" @tap.stop="DelImg" :data-index="index">
								<text class='cuIcon-close'></text>
							</view>
						</view>
						<view class="solids r30" @tap="ChooseImage" v-if="imgList.length<1">
							<image src="/static/sfzr.png" mode='widthFix'></image>
						</view>
					</view>
				</view>

				<view class="bc" style="margin-top: 30px;">
					<view class="r30" style="width: 150px;">
						<view class="">身份证国徽面</view>
						<view class="action">
							{{imgList2.length}}/1
						</view>
					</view>
				</view>
				<view class="cu-form-group">
					<view class="grid col-4 grid-square flex-sub">
						<view class="bg-img r30" v-for="(item,index) in imgList2" :key="index" @tap="ViewImage2"
							:data-url="imgList2[index]">
							<image :src="imgList2[index]" mode='widthFix'></image>
							<view class="cu-tag bg-red" @tap.stop="DelImg2" :data-index="index">
								<text class='cuIcon-close'></text>
							</view>
						</view>
						<view class="solids" @tap="ChooseImage2" v-if="imgList2.length<1">
							<image src="/static/sfzg.png" mode='widthFix'></image>
						</view>
					</view>
				</view>
			</view>
			<hr>
			<view class="bc b20" style="margin-bottom: 30px;">
				<view class="bc r30">
					<i class="ri-bank-card-fill" style="color:#7800BE;font-size:30px;"></i>
					<!-- <i-icon size="30px" color="#7800BE" name="bank-card-fill"></i-icon> -->
					<text style="font-size: 28px;">绑定银行卡</text>
				</view>
				<view class="bc red" style="font-size: 12px;">
					<i class="ri-information-fill" style="color:#f73164;font-size:20px;"></i>
					<!-- <i-icon size="20px" color="#f73164" name="information-fill"></i-icon> -->
					用于提现时使用
				</view>
			</view>
			<view class="">
				<view class="bk b10 bc">
					<view class="r30" style="width: 150px;">开户行</view>
					<input type="text" v-model="bankName" placeholder="开户行" @click="showDrawer" style="width:400px;" />
					<uni-drawer ref="showRight" mode="right" :mask-click="true">
						<scroll-view style="height: 100%;" scroll-y="true">
							<view v-for="item in array" :key="item" @click="getBankname(item)">{{ item }}</view>
						</scroll-view>
					</uni-drawer>
				</view>
				<view class="bk b10 bc">
					<view class="r30" style="width: 150px;">银行卡号</view>
					<input type="number" v-model="acctNo" maxlength="20" placeholder="银行卡号" style="width:400px;" />
				</view>
				<view class="bc b10">
					<view class="bk b10 bc">
						<view class="r30" style="width: 150px;">手机号码</view>
						<input type="number" v-model="mobile" maxlength="11" placeholder="预留手机号" class="r10" />
					</view>
					<button type="default" @click="getOpenCode()">获取验证码</button>
				</view>
				<view class="bk b10">
					<view class="bk b10 bc">
						<view class="r30" style="width: 150px;">验证码</view>
						<input type="number" v-model="messageCode" maxlength="6" placeholder="输入验证码" />
					</view>
				</view>
				<view class="b10 bk">
					<view class="bk b10 bc">
						<view class="r30" style="width: 150px;"></view>
						<button @click="toKtqb()">确认</button>
					</view>
				</view>
				<view class="b10 bk">
					<view class="bk b10 bc">
						<view class="r30" style="width: 150px;"></view>
						<label @click="state=!state" class=" bc">
							<checkbox :value="temp" /><text>
								<navigator url="../admin/xy">阅读并同意《武汉众邦银行E账通平台子账户服务协议》</navigator>
							</text>
						</label>
					</view>
				</view>
			</view>
		</view>
		<!-- <button @click="open = 1">弹出</button> -->
		<view v-if="open==1" class="p-tkb">
			<view class="p-tkh"></view>
			<view class="p-tk" style="width: 300px; height: 300px;">
				<view class="tb">
					<view class="titem">
						<i class="ri-add-circle-fill" style="color:#7800BE;font-size:20px;"></i>
						<!-- <i-icon size="20upx" color="#7800BE" name="add-circle-fill" class="r10"></i-icon> -->
						设置交易密码
					</view>
					<i class="ri-close-circle-fill" style="color:#f73164;font-size:20px;" @click="opens=false"></i>
					<!-- <i-icon size="25upx" color="#f73164" name="close-circle-fill" @click="opens=false"></i-icon> -->
				</view>
				<view class="com">
					<view class="li bc">
						<view class="wz">交易密码</view>
						<view class="nr"><input type="password" v-model="password"></view>
					</view>
					<view class="li bc">
						<view class="wz">确认交易密码</view>
						<view class="nr"><input type="password" v-model="passwords"></view>
					</view>
					<view class="bc" style="margin-left: 90px;">
						<button type="button" @click="addTwoData()" style="width: 100px;">
							<i class="ri-arrow-right-s-line" style="color:#fff;font-size:14px;"></i>
							<!-- <i-icon size="20upx" color="#fff" name="arrow-right-s-line"></i-icon> -->
							确认
						</button>
					</view>
				</view>
			</view>
		</view>
	</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				agree: false,
				temp: '',
				userName: '',
				cerNo: '',
				bankAccName: '',
				mobile: '',
				messageCode: '',
				acctNo: '',
				disabled: false,
				opens: 0,
				class2: 'btns2',
				timer: 60,
				title: '获取验证码',
				password: '',
				passwords: '',
				state: false,
				state2: false,
				array: ["﻿中国工商银行", "中国农业银行", "中国银行", "中国邮政储蓄银行", "中国建设银行", "国家开发银行", "中国进出口银行", "中国农业发展银行", "交通银行", "中信银行",
					"中国光大银行银行", "华夏银行",
					"中国民生银行", "广发银行", "平安银行", "招商银行", "兴业银行", "桂林银行", "广西北部湾银行", "上海浦东发展银行", "北京银行", "天津银行", "河北银行",
					"唐山银行股份", "秦皇岛银行股",
					"邯郸银行", "邢台银行", "保定银行", "张家口银行", "承德银行", "沧州银行", "廊坊银行", "衡水银行", "晋商银行", "大同银行", "阳泉市商业银行", "长治银行",
					"晋城银行", "晋中银行", "内蒙古银行", "包商银行", "乌海银行", "盛京银行", "鄂尔多斯银行", "大连银行", "鞍山银行", "抚顺银行", "本溪市商业银行",
					"丹东银行", "锦州银行", "葫芦岛银行", "营口银行", "营口沿海银行", "阜新银行", "辽阳银行", "盘锦银行", "铁岭银行", "朝阳银行", "吉林银行", "哈尔滨银行",
					"龙江银行", "南京银行", "江苏银行", "苏州银行", "江苏长江商业银行", "杭州银行", "宁波东海银行", "宁波银行", "宁波通商银行", "温州银行", "嘉兴银行",
					"湖州银行", "绍兴银行", "金华银行", "浙江稠州商业银行", "台州银行", "浙江泰隆商业银行", "浙江民泰商业银行", "福建海峡银行", "厦门银行", "泉州银行",
					"江西银行", "九江银行", "赣州银行", "上饶银行", "齐鲁银行", "青岛银行", "齐商银行", "枣庄银行", "东营银行", "烟台银行", "潍坊银行", "济宁银行",
					"泰安银行", "莱商银行", "威海市商业银行", "德州银行股份", "临商银行股份", "日照银行股份", "郑州银行", "中原银行", "洛阳银行", "平顶山银行股",
					"焦作中旅银行", "汉口银行", "湖北银行", "华融湘江银行", "长沙银行", "广州银行", "珠海华润银行", "广东华兴银行", "广东南粤银行", "东莞银行",
					"柳州银行", "海南银行", "成都银行", "重庆银行", "自贡银行", "攀枝花市商业银行", "泸州市商业银", "长城华西银行",
					"绵阳市商业银行", "遂宁银行股份", "乐山市商业银行", "宜宾市商业银", "四川天府银行", "达州市商业银行", "雅安市商业银行", "凉山州商业银行", "贵阳银行",
					"贵州银行", "富滇银行", "曲靖市商业银行", "云南红塔银行", "西藏银行", "西安银行", "长安银行", "兰州银行", "甘肃银行", "青海银行股份", "宁夏银行",
					"石嘴山银行", "乌鲁木齐银行", "昆仑银行", "哈密市商业银行", "库尔勒银行", "新疆汇和银行", "天津滨海农村商业银行", "大连农村商业银行", "无锡农村商业银行",
					"江苏江阴农村商业银行", "江苏江南农村商业银行", "太仓农村商业银行", "江苏昆山农村", "吴江农村商业银行", "江苏常熟农村商业银行", "张家港农村商业银行",
					"广州农村商业银行", "广东顺德农村银行", "海口联合农村银行", "成都农商银行", "重庆农村商业银行", "恒丰银行", "浙商银行", "天津农村商业银行", "渤海银行",
					"徽商银行", "重庆三峡银行", "上海农商银行", "天津金城银行", "上海华瑞银行", "浙江网商银行", "重庆富民银行", "上海银行", "北京农村商业银行",
					"河北省农村商业银行", "山西省农村商业银行", "内蒙古农村商业银行", "辽宁省农村商业银行", "吉林省农村商业银行", "黑龙江农村商业银行", "江苏省农村商业银行",
					"浙江省农村商业银行", "宁波鄞州农村商业银行", "安徽省农村商业银行", "福建省农村商业银行", "江西省农村商业银行", "山东省农村商业银行", "河南省农村商业银行",
					"湖北省农村商业银行", "武汉农村商业银行", "湖南省农村商业银行", "广东省农村信用合作联社", "深圳农村商业银行", "东莞农村商业银行", "广西省农村信用合作联社",
					"海南省农村商业银行", "四川省农村信用合作联社", "贵州省农村信用合作联社", "云南省农村信用合作联社", "陕西省农村商业银行", "甘肃省农村商业银行", "青海省农村信用合作联社",
					"宁夏省农村信用合作联社", "新疆省农村商业银行", "温州民商银行", "深圳前海微众银行", "四川新网银行", "众邦银行",
					"南阳村镇银行股份有限公司"
				],
				bankName: '',
				cerStartDate: '',
				cerEndDate: '',
				imgList: [],
				imgList2: [],
				certFrontUrl: '',
				certBackUrl: '',
				index: 0,
				openInfo: 0
			}
		},
		methods: {
			showDrawer() {
				this.$refs.showRight.open();
			},
			closeDrawer() {
				this.$refs.showRight.close();
			},
			getBankname(item) {
				//console.log(item)
				this.bankName = item;
				this.$refs.showRight.close();
			},
			/**
			 * 查询该token是否有添加过开户信息
			 */
			getOpenInfo() {
				let token = uni.getStorageSync('token');
				let tthis = this;
				if (token == null) {
					uni.showToast({
						title: '用户未登录'
					})
					return;
				}
				uni.request({
					url: tthis.baseURL + '/gr/find/one',
					method: "POST",
					header: {
						'token': token
					},
					success(res) {
						console.log(res)
						if (res.data.success == true) {
							let rData = res.data.data[0];
							console.log(res.data.data[0])
							tthis.acctNo = rData.acctNo;
							tthis.bankAccName = rData.bankAccName;
							tthis.bankName = rData.bankName;
							tthis.cerEndDate = rData.cerEndDate;
							tthis.cerNo = rData.cerNo;
							tthis.cerStartDate = rData.cerStartDate;
							tthis.mobile = rData.mobile;
							tthis.openInfo = 1; //开户信息状态
						} else {
							tthis.openInfo = 0;
							console.log("未添加开户信息")
						}
					},
					fail(err) {
						console.log(err)
						uni.showToast({
							title: err.message,
							icon: 'error'
						})
					}
				})
			},

			ChooseImage() { //身份证信息面
				let _this = this;
				uni.chooseImage({
					count: 1, //默认9
					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
					//sourceType: ['camera'], //从相册选择
					success: (res) => {
						if (this.imgList.length != 0) {
							this.imgList = this.imgList.concat(res.tempFilePaths)
						} else {
							this.imgList = res.tempFilePaths
						}
						const tempFilePaths = res.tempFilePaths;
						const uploadTask = uni.uploadFile({
							url: this.baseURL + '/com/upload?fileType=certBack',
							header: {
								'token': uni.getStorageSync('token')
							},
							filePath: tempFilePaths[0],
							name: 'file',
							success: function(uploadFileRes) {
								if (uploadFileRes.statusCode == 200) {
									let fileData = JSON.parse(uploadFileRes.data)
									console.log(fileData);
									_this.certFrontUrl = fileData.data.fileId; //给地址赋值
									//this.imgList = [...this.imgList, uploadFileRes.data]
								} else {
									uni.showToast({
										title: '上传图片不能超过2M，请重新上传',
										icon: 'none',
										duration: 2500
									})
									_this.imgList = [];
								}
							},
							fail: function(err) {
								uni.showToast({
									title: err,
									icon: 'none',
									duration: 2000
								})
							}
						});
					}
				});
			},
			ViewImage(e) {
				uni.previewImage({
					urls: this.imgList,
					current: e.currentTarget.dataset.url
				});
			},
			//删除
			DelImg(e) {
				uni.showModal({
					title: '删除',
					content: '确定要删除这张图片？',
					cancelText: '取消',
					confirmText: '删除',
					success: res => {
						if (res.confirm) {
							this.imgList.splice(e.currentTarget.dataset.index, 1)
						}
					}
				})
			},
			ChooseImage2() { //身份证国徽面
				let _this = this;
				uni.chooseImage({
					count: 1, //默认9
					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
					//sourceType: ['camera'], //从相册选择
					success: (res) => {
						if (this.imgList2.length != 0) {
							this.imgList2 = this.imgList2.concat(res.tempFilePaths)
						} else {
							this.imgList2 = res.tempFilePaths
						}
						const tempFilePaths = res.tempFilePaths;
						const uploadTask2 = uni.uploadFile({
							url: this.baseURL + '/com/upload?fileType=certFront',
							header: {
								'token': uni.getStorageSync('token')
							},
							filePath: tempFilePaths[0],
							name: 'file',
							success: function(uploadFileRes) {
								if (uploadFileRes.statusCode == 200) {
									let fileData = JSON.parse(uploadFileRes.data)
									console.log(fileData.data.fileId);
									_this.certBackUrl = fileData.data.fileId
									//this.imgList = [...this.imgList, uploadFileRes.data]
								} else {
									uni.showToast({
										title: '上传图片不能超过2M，请重新上传',
										icon: 'none',
										duration: 2500
									})
									_this.imgList2 = [];
								}
							},
							fail: function(err) {
								uni.showToast({
									title: err,
									icon: 'none',
									duration: 2000
								})
							}
						});
					}
				});
			},
			ViewImage2(e) {
				uni.previewImage({
					urls: this.imgList2,
					current: e.currentTarget.dataset.url
				});
			},
			//删除
			DelImg2(e) {
				uni.showModal({
					title: '删除',
					content: '确定要删除这张图片？',
					cancelText: '取消',
					confirmText: '删除',
					success: res => {
						if (res.confirm) {
							this.imgList2.splice(e.currentTarget.dataset.index, 1)
						}
					}
				})
			},

			//时间选择器
			timestampChange: function(c) {
				console.log(c)
				this.cerStartDate = c;

			},
			timestampChange2: function(c) {
				this.state2 = false;
				console.log(c)
				this.cerEndDate = c;
			},
			//验证码校验
			verify() {
				if (this.bankName == '') {
					uni.showToast({
						title: '请输入您的开户行',
						icon: 'none',
						duration: 2000
					})
					this.class2 = 'btns2';
					return;
				}

				if (this.bankAccName == '') {
					uni.showToast({
						title: '请输入您的开户名',
						icon: 'none',
						duration: 2000
					})
					this.class2 = 'btns2';
					return;
				}
				if (this.cerNo == '') {
					uni.showToast({
						title: '请输入您的身份证号',
						icon: 'none',
						duration: 2000
					})
					this.class2 = 'btns2';
					return;
				}
				if (this.acctNo == '') {
					uni.showToast({
						title: '请输入您的银行卡号',
						icon: 'none',
						duration: 2000
					})
					this.class2 = 'btns2';
					return;
				}
				if (this.mobile == '' || this.mobile.length != 11) {
					uni.showToast({
						title: '请输入正确的手机号',
						icon: 'none',
						duration: 2000
					})
					this.class2 = 'btns2';
					return;
				}
				this.class2 = 'btns';
			},

			bindPickerChange: function(e) {
				console.log('picker发送选择改变，携带值为', e.target.value)
				let arrid = e.target.value;
				console.log('选择到的值是：', this.array[arrid])
				this.bankName = this.array[arrid];
				this.index = arrid;
				console.log('bankName的当前值为:' + this.bankName)
			},
			checkboxChange2(e) {
				this.state2 = !this.state2;

				if (this.state2 == true) {
					this.cerEndDate = '长期';
					console.log(this.cerEndDate)
				}
				console.log(this.state2);
			},

			//获取验证码
			getOpenCode() {
				this.userName = this.bankAccName;
				let userName = this.userName;
				let cerNo = this.cerNo;
				let phone = this.mobile;
				let acctNo = this.acctNo;
				let reqdata = JSON.stringify({
					'mobile': phone,
					'cerNo': cerNo,
					'userName': userName,
					'acctNo': acctNo
				});

				if (this.bankName == '') {
					uni.showToast({
						title: '请输入您的开户行',
						icon: 'none',
						duration: 2000
					})
					return;
				}

				if (this.bankAccName == '') {
					uni.showToast({
						title: '请输入您的开户名',
						icon: 'none',
						duration: 2000
					})
					return;
				}
				if (this.cerNo == '') {
					uni.showToast({
						title: '请输入您的身份证号',
						icon: 'none',
						duration: 2000
					})
					return;
				}
				if (this.acctNo == '') {
					uni.showToast({
						title: '请输入您的银行卡号',
						icon: 'none',
						duration: 2000
					})
					return;
				}
				if (phone == '' || phone.length != 11) {
					uni.showToast({
						title: '请输入正确的手机号',
						icon: 'none',
						duration: 2000
					})
					return;
				}

				if (this.timer == 60) {
					this.disabled = true

					let timer1 = setInterval(() => {
						this.timer--;
						this.title = this.timer + '秒后重试'
						if (this.timer == 0) {
							clearInterval(timer1);
							this.timer = 60;
							this.disabled = false
							this.title = '获取验证码'
							return;
						}
					}, 1000);
				}
				uni.request({
					url: this.baseURL + '/gr/get/code?mobile=' + phone + '&cerNo=' + cerNo + '&userName=' +
						userName + '&acctNo=' + acctNo,
					method: 'POST',
					//data:reqdata,
					header: {
						'token': uni.getStorageSync('token')
					},
					dataType: 'json',
					success: (res) => {
						console.log(res)
						if (res.data.success == true) {
							uni.showToast({
								title: '发送成功',
								duration: 2000
							})
						}
						if (res.data.success == false) {
							uni.showToast({
								title: res.data.message,
								icon: 'none',
								duration: 2000
							})
						}
					}
				})
			},


			/**
			 * 提交开户申请
			 */
			toKtqb() {
				let tttdata = this;
				this.userName = tttdata.bankAccName;
				if (this.state == false) {
					uni.showToast({
						title: '请同意协议',
						icon: 'none'
					})
					return;
				}
				if (this.cerStartDate == '') {
					uni.showToast({
						title: '请选择身份证开始日期',
						icon: 'none'
					})
					return;
				}
				if (this.cerEndDate == '') {
					uni.showToast({
						title: '请选择身份证结束日期',
						icon: 'none'
					})
					return;
				}
				if (this.imgList.length == 0) {
					uni.showToast({
						title: '请上传身份证信息面',
						icon: 'none'
					})
					return;
				}
				if (this.imgList2.length == 0) {
					uni.showToast({
						title: '请上传身份证国徽面',
						icon: 'none'
					})
					return;
				}
				if (this.userName == '') {
					uni.showToast({
						title: '请输入您的姓名',
						icon: 'none',
						duration: 2000
					})
					return;
				}
				if (this.cerNo == '') {
					uni.showToast({
						title: '请输入您的身份证号',
						icon: 'none',
						duration: 2000
					})
					return;
				}
				if (this.bankName == '') {
					uni.showToast({
						title: '请输入您的开户行',
						icon: 'none',
						duration: 2000
					})
					return;
				}
				if (this.bankAccName == '') {
					uni.showToast({
						title: '请输入您的开户名',
						icon: 'none',
						duration: 2000
					})
					return;
				}
				if (this.acctNo == '') {
					uni.showToast({
						title: '请输入您的银行卡号',
						icon: 'none',
						duration: 2000
					})
					return;
				}
				if (this.mobile == '') {
					uni.showToast({
						title: '请输入您的手机号',
						icon: 'none',
						duration: 2000
					})
					return;
				}
				if (this.messageCode == '') {
					uni.showToast({
						title: '请输入验证码',
						icon: 'none',
						duration: 2000
					})
					return;
				}
				//没有开户信息，调用添加接口
				if (this.openInfo == 0) {
					uni.request({
						url: this.baseURL + '/gr/add/gr',
						method: 'POST',
						data: {
							'userName': tttdata.userName,
							'acctNo': tttdata.acctNo,
							'bankAccName': tttdata.bankAccName,
							'mobile': tttdata.mobile,
							'cerNo': tttdata.cerNo,
							'bankName': tttdata.bankName,
							'messageCode': tttdata.messageCode,
							'cerStartDate': tttdata.cerStartDate,
							'cerEndDate': tttdata.cerEndDate,
							'certFrontUrl': tttdata.certFrontUrl,
							'certBackUrl': tttdata.certBackUrl
						},
						header: {
							'token': uni.getStorageSync('token')
						},
						dataType: 'json',
						success: (res) => {
							console.log(res);
							if (res.data.success == true) {
								uni.showToast({
									title: '提交成功，请设置交易密码',
									duration: 3000,
									icon: "success"
								})
								tttdata.open = 1;
							}
							if (res.data.success == false) {
								uni.showToast({
									title: res.data.message,
									icon: 'error',
									duration: 2000
								})
							}
						},
						fail(err) {
							console.log(err)
							uni.showToast({
								title: err,
								icon: 'error',
								duration: 2000
							})
						}
					})
				}
				//有开户信息，调用修改接口
				if (this.openInfo == 1) {

					uni.request({
						url: this.baseURL + '/gr/redo/info?userName=' + this.bankAccName + '&cerNo=' + this.cerNo,
						method: 'POST',
						header: {
							'token': uni.getStorageSync('token')
						},
						data: {
							'userName': tttdata.userName,
							'acctNo': tttdata.acctNo,
							'bankAccName': tttdata.bankAccName,
							'mobile': tttdata.mobile,
							'cerNo': tttdata.cerNo,
							'bankName': tttdata.bankName,
							'messageCode': tttdata.messageCode,
							'cerStartDate': tttdata.cerStartDate,
							'cerEndDate': tttdata.cerEndDate,
							'certFrontUrl': tttdata.certFrontUrl,
							'certBackUrl': tttdata.certBackUrl
						},
						success(res) {
							console.log(res)
							if (res.data.success == true) {
								uni.showToast({
									title: '提交成功，请设置交易密码',
									icon: 'success',
									duration: 3000
								})
								tttdata.open = 1;
							} else {
								uni.showToast({
									title: res.data.message,
									icon: 'error',
									duration: 2000
								})
							}
						},
						fail(err) {
							console.log(err)
							uni.showToast({
								title: err,
								icon: 'error',
								duration: 2000
							})
						}
					})
				}
			},

			/**
			 * 填完交易密码开始开户
			 */
			addTwoData() {
				if (this.password == '' || this.password == null) {
					uni.showToast({
						title: '请输入交易密码',
						icon: 'none',
						duration: 2000
					})
					return;
				}
				if (this.passwords == '' || this.passwords == null) {
					uni.showToast({
						title: '请确认您的交易密码',
						icon: 'none',
						duration: 2000
					})
					return;
				}
				if (this.password != this.passwords) {
					uni.showToast({
						title: '两次密码不相同',
						icon: 'none',
						duration: 2000
					})
					return;
				}

				uni.request({
					url: this.baseURL + '/gr/open/gr?acctNo=' + this.acctNo + '&password=' + this.password +
						'&code=' + this.messageCode,
					method: 'POST',
					header: {
						'token': uni.getStorageSync('token')
					},
					dataType: 'json',
					success: (res) => {
						console.log(res);
						if (res.data.success == true) {
							uni.showToast({
								title: '提交成功，审核预计五分钟',
								duration: 3000
							})
							setTimeout(function() {
								uni.reLaunch({
									url: 'account-gr-info'
								})
							}, 3000)
						}
						if (res.data.success == false) {
							uni.showToast({
								title: res.data.message,
								icon: 'none',
								duration: 2000
							})
						}
					}
				})
			}
		},
		onLoad() {
			this.getOpenInfo();
		}
	}
</script>
<style>
	hr {
		margin-top: 50px;
		margin-bottom: 50px;
	}

	.bk {
		height: 60px;
		line-height: 60px;
	}
</style>
